<? /* license

BilugCMS (http://www.bilug.it) - Content Management System for dynamic web sites
Copyright (C) 2005-2008  Federico Villa and Alessio Loro Piana

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

For reference, contact bilugcms@vilnet.it


license */ ?>


<?
session_start();
$idecom = session_id();

 if (!isset($_SESSION['arearis']) or $_SESSION['arearis']<=0) {?>
<form name="login" method="post" action="ecommerce_guardian.php">
<div class="blocco">
	<!--h3><?=$titolo?></h3-->
	<h3>Area Liste Nozze</h3>
   <p>Password</p>
   <p><input type="password" name="ris" size="15" id="textlato"/></p>
   <p><input type="submit" value="Login" id="bottomlato"/></p>
</div>
</form>
<?}
else
{
?>
	<div class="blocco">
	<!--h3><?=$titolo?></h3-->
	<h3>Area Liste Nozze</h3>
<?	$str="SELECT nome, note, id FROM ecommerceris WHERE ID='".$_SESSION['arearis']."'";
   $risultato=mysql_query($str);
   if (mysql_num_rows($risultato)>0)
   $control=mysql_fetch_row($risultato); 
   $idut = $control[2];
   echo "<p>Utente: $control[0]</p>";
   echo "<p>$control[1]</p>";
   ?>
	<div class="blocco">
	<br />
	<h3>Categorie:</h3>	

	<!-- elenco categorie -->
	<?
	#$str="SELECT id,categoria FROM ecommercecategoria order by categoria";
	$str="SELECT id,categoria, riservato FROM ecommerce GROUP BY categoria ORDER BY categoria";
	$risultato=mysql_query($str);
	if (mysql_num_rows($risultato)>0)
	{
		echo "<ul>";
		echo"<li><a href=\"index.php?pag=ecommerce_ris.php&idut=$idut\">TUTTE</a></li>";
		while($control=mysql_fetch_row($risultato))
				{
				echo "
				<li><a href=\"index.php?pag=ecommerce_ris.php&categoria=$control[1]&idut=$idut\">$control[1]</a></li>
				";
				}
	   echo "</ul>";
	}
	else
		echo "<ul><li>Nessun Argomento</li></ul>";


	?>

	<!-- include carrello se attivo o no include se disattivo-->
	<?
	$carrello1=$_GET['carrello1'];
	if($carrello1!="")
	{
		$_SESSION['carrello1']="si";
	}
	$carrello1=$_POST['carrello1'];
	if($carrello1!="")
	{
		if($carrello1=="si")
		{
			$_SESSION['carrello1'] = "si";
		}
		if($carrello1=="no")
		{
			$_SESSION['carrello1'] = "no";
			/*	
			session_unset();
			session_destroy();
			*/
		}
	}

	if($_SESSION['carrello1']=="si")
	{
		echo "<br><a href=\"index.php?pag=ecommerce_dettaglio_carrello.php\"><h3>Carrello<img src=\"../img/carrello1.png\" class=\"linkico\"> </h3></a> ";
		include("ecommerce_carrello_pub_ris.php");	
		?>
			<br><br>
			<form name="carrello" method="post" action="<?$_SERVER['PHP_SELF']?>" enctype="multipart/form-data">
			<input type="hidden" name="carrello1" value="no"/>
			<input type="submit" value="Disattiva carrello" id="bottomlato">
			</form>
		<?
	}
	if($_SESSION['carrello1']=="no" or $_SESSION['carrello1']=="")
	{
			?>
				<br><br>
				<form name="carrello" method="post" action="<?$_SERVER['PHP_SELF']?>" enctype="multipart/form-data">
				<input type="hidden" name="carrello1" value="si"/>
				<input type="submit" value="Attiva carrello" id="bottomlato">
				</form>
			<?	
	}

	?>
	<br />
	<p>Cerca negli articoli:</p>
	<form name="ecommercericerca" method="post" action="index.php?pag=ecommerce_ris.php" enctype="multipart/form-data">
	<input type="hidden" name="cerca" value="si"/>
	<input type="text" name="parola" id="textlato">
	<input type="submit" value="Cerca" id="bottomlato">
	</form>
	</div>   
	<p><a href="?pag=exit.php">Esci</a></p>
</div>
<?}?>





<div style="height:30px;"></div>







<?php /* ecommerce pubblico */ ?>

<?php
if ( !@$idut ) {
?>

	<!-- ricerca tra gli articoli -->
	<div class="blocco">
		<!--h3><?=$titolo?></h3-->	
		<h3>
			<img id="ico" src="../img/e.png" original="../img/e.png" style="display: inline;" />
			- Commerce
		</h3>	
	<form name="ecommercericerca" method="post" action="index.php?pag=ecommerce.php" enctype="multipart/form-data">
	<input type="hidden" name="cerca" value="si"/>
	<input type="text" name="parola" id="textlato">
	<input type="submit" value="Cerca" id="bottomlato">
	</form>
	<br>
	<h3>Categorie:</h3>	

	<!-- elenco categorie -->
	<?
	#$str="SELECT id,categoria FROM ecommercecategoria order by categoria";
	$str="SELECT id,categoria, riservato FROM ecommerce WHERE riservato = 0 GROUP BY categoria ORDER BY categoria";
	$risultato=mysql_query($str);
	if (mysql_num_rows($risultato)>0)
	{
		echo "<ul>";
		echo"<li><a href=\"index.php?pag=ecommerce.php\">TUTTE</a></li>";
		while($control=mysql_fetch_row($risultato))
				{
				echo "
				<li><a href=\"index.php?pag=ecommerce.php&categoria=$control[1]\">$control[1]</a></li>
				";
				}
	   echo "</ul>";
	}
	else
		echo "<ul><li>Nessun Argomento</li></ul>";


	?>

	<!-- include carrello se attivo o no include se disattivo-->
	<?
	$carrello2=$_GET['carrello2'];
	if($carrello2!="")
	{
		$_SESSION['carrello2']="si";
	}
	$carrello2=$_POST['carrello2'];
	if($carrello2!="")
	{
		if($carrello2=="si")
		{
			$_SESSION['carrello2']="si";
		}
		if($carrello2=="no")
		{
			$_SESSION['carrello2']="no";
			/*	
			session_unset();
			session_destroy();
			*/
		}
	}

	if($_SESSION['carrello2']=="si")
	{
		echo "<br><a href=\"index.php?pag=ecommerce_dettaglio_carrello.php\"><h3>Carrello<img src=\"../img/carrello1.png\" class=\"linkico\"> </h3></a> ";
		include("ecommerce_carrello_pub_ris.php");	
		?>
			<br><br>
			<form name="carrello2" method="post" action="<?$_SERVER['PHP_SELF']?>" enctype="multipart/form-data">
			<input type="hidden" name="carrello2" value="no"/>
			<input type="submit" value="Disattiva carrello" id="bottomlato">
			</form>
		<?
	}
	if($_SESSION['carrello']=="no" or $_SESSION['carrello']=="")
	{
			?>
				<br><br>
				<form name="carrello2" method="post" action="<?$_SERVER['PHP_SELF']?>" enctype="multipart/form-data">
				<input type="hidden" name="carrello2" value="si"/>
				<input type="submit" value="Attiva carrello" id="bottomlato">
				</form>
			<?	
	}

	?>

	</div>
<?php
}
?>

